var httpConnectionFeature = httpContext.Features.Get<IHttpConnectionFeature>(); var localIpAddress = httpConnectionFeature?.LocalIpAddress;